import type { IOptionType, IPageInfoType, IRadioGroupOptionType } from './type';
import {
  ITradeDirectionType,
  IContractSourceType,
  IPositionsCalculateType,
  IOperationType,
  IPointerType,
  ITemplateType,
} from './type';

export const tradeDirectionOptions: IOptionType[] = [
  { label: '全部方向', value: ITradeDirectionType.ALL_DIRECTION },
  { label: '买入', value: ITradeDirectionType.BUY },
  { label: '卖出', value: ITradeDirectionType.SELL },
];

export const contractSourceOptions: IOptionType[] = [
  { label: '全部来源', value: IContractSourceType.ALL_TYPE },
  { label: '交易中心', value: IContractSourceType.TRADING_CENTER },
  { label: '交易中心-常规合约', value: IContractSourceType.TRADING_CENTER_NOMAL },
  { label: '交易中心-虚拟合约', value: IContractSourceType.TRADING_CENTER_VIRTUAL },
  { label: '用户上传', value: IContractSourceType.USER_UPLOAD },
];

export const positionsCalculateOptions: IOptionType[] = [
  { label: '全部情况', value: IPositionsCalculateType.ALL_TYPE },
  { label: '参与', value: IPositionsCalculateType.TAKE_PART_IN },
  { label: '不参与', value: IPositionsCalculateType.DROP_OUT },
];

export const operationList: IOptionType[] = [
  { label: '详情', value: IOperationType.DETAIL },
  { label: '编辑', value: IOperationType.EDIT },
  { label: '删除', value: IOperationType.DETELE },
  { label: '导出', value: IOperationType.EXPORT },
];

export const pointerOptions: IOptionType[] = [
  { label: '24', value: IPointerType.TWENTY_FOUR_POINT },
  { label: '96', value: IPointerType.NINETY_SIX_POINT },
];

export const defaultPageInfo: IPageInfoType = {
  total: 0,
  page: 1,
  currentPage: 1,
  size: 100,
};

export const contractTypesOptions: IOptionType[] = [
  {
    label: '中长期',
    value: '1',
    children: [
      { label: '基数', value: '1-1' },
      { label: '外送', value: '1-2' },
      { label: '直接交易', value: '1-3' },
      { label: '电能替代', value: '1-4' },
      { label: '发电权', value: '1-5' },
      { label: '合同转让', value: '1-6' },
      { label: '优先发电', value: '1-7' },
      { label: '辅助服务', value: '1-8' },
      { label: '其他', value: '1-9' },
    ],
  },
  {
    label: '现货',
    value: '2',
    children: [
      { label: '省间现货', value: '2-1' },
      { label: '省内现货', value: '2-2' },
      { label: '其他', value: '2-3' },
    ],
  },
  {
    label: '辅助服务',
    value: '3',
    children: [
      { label: '省内辅助服务费用', value: '3-1' },
      { label: '省内辅助服务费用(深调)', value: '3-2' },
      { label: '省内辅助服务费用(启停)', value: '3-3' },
      { label: '省间辅助服务费用', value: '3-4' },
    ],
  },
  {
    label: '两个细则',
    value: '4',
    children: [
      { label: '两个细则考核', value: '4-1' },
      { label: '储能调峰', value: '4-2' },
    ],
  },
  {
    label: '其他',
    value: '5',
    children: [{ label: '其他（非交易）', value: '5-1' }],
  },
];

export const downLoadTemplate: IOptionType[] = [
  { label: '日间同曲线-96点模板', value: ITemplateType.DAYTIME_SAME_CURVE_NINETY_SIX_POINT },
  { label: '日间同曲线-24点模板', value: ITemplateType.DAYTIME_SAME_CURVE_TWENTY_FOUR_POINT },
  { label: '日间分曲线-96点模板', value: ITemplateType.DIURNAL_NINETY_SIX_POINT },
  { label: '日间分曲线-24点模板', value: ITemplateType.DIURNAL_TWENTY_FOUR_POINT },
];

export const tradeOptions: IRadioGroupOptionType[] = [
  {
    label: '卖出',
    value: ITradeDirectionType.SELL,
    color: '#FFFFFF',
    backgroundColor: '#FD4F43',
    defaultColor: '#7A7D7F',
    defaultBackgroundColor: '#383C3E',
  },
  {
    label: '买入',
    value: ITradeDirectionType.BUY,
    color: '#FFFFFF',
    backgroundColor: '#30D485',
    defaultColor: '#7A7D7F',
    defaultBackgroundColor: '#383C3E',
  },
];

export const contractSourceHintText: string =
  '合约数据来源大体分为平台获取和用户人工维护两种，前者不支持编辑删除操作。';

export const positionsCalculateHintText: string =
  '由于数据口径与合约状态差异，部分合约可能不参与用户仓位计算，本字段用于区分“参与”及“不参与”计算仓位的合约。用户维护的合约可进行自由编辑。';

export const SAME_DATE = '日曲线';

export const timeSliceObjType: any = {
  尖: '尖',
  高峰: '峰',
  平: '平',
  低谷: '谷',
};

export const totalColorDic: any = {
  尖: '#FB6E77',
  高峰: '#D29E08',
  平: '#07A872',
  低谷: '#2174FF',
  尖峰: '#ff1313',
  深谷: '#979191',
};

export const powerTypeList = ['风电', '光伏', '水电', '火电'];

export const plainOptions = Object.entries(timeSliceObjType).map((t) => ({
  label: t[1] + '时段',
  value: t[0],
}));

const color = {
  color: '#FFFFFF',
  backgroundColor: '#FD4F43',
  defaultColor: '#7A7D7F',
  defaultBackgroundColor: '#383C3E',
};
export const timeSliceOptions = Object.entries(timeSliceObjType).map((t) => ({
  label: t[1],
  value: t[0],
  ...color,
}));

export const userTypeOptions = [
  {
    label: '交易中心',
    value: '0',
  },
  {
    label: '发电企业',
    value: '1',
  },
  {
    label: '用电企业',
    value: '2',
  },
  {
    label: '政府',
    value: '3',
  },
  {
    label: '供电公司',
    value: '4',
  },
  {
    label: '售电公司',
    value: '5',
  },
];
export const powerTypeOptions = powerTypeList.map((t) => ({
  label: t,
  value: t,
}));

export const totalMap = [
  { name: '合约电量', unit: 'MWh', key: 'totalContractQuantity' },
  { name: '统计电量', unit: 'MWh', key: 'statisticsPower' },
  { name: '均价', unit: '元/MWh', key: 'totalContractPrice' },
];

export const excelMap: any = {
  售电方: 'sellerPurchaserName',
  购电方: 'powerPurchaserName',
  交易序列名称: 'tradeSequenceName',
  合同编号: 'contractId',
  合同名称: 'contractName',
  '电量（MWH）': 'contractQuantity',
  '电价（元/MWH）': 'contractPrice',
  电源类型: 'powerSourceType',
  月份: 'month',
  时段: 'tag',
};
